package cn.lg.soar.system.tenant.entity;

import cn.lg.soar.common.util.trans.annotations.TranslateName;
import cn.lg.soar.core.util.easyexcel.converters.BooleanConverter;
import cn.lg.soar.database.base.entity.BaseEntity;
import cn.lg.soar.database.translate.TranslateByEntity;
import cn.lg.soar.system.general.entity.DataSource;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 租户
 * @author luguoxiang
 * @since 2022-04-30
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "Tenant", description = "租户")
@TableName("lg_sys_tenant")
public class Tenant extends BaseEntity {

    private static final long serialVersionUID=1L;

    @ExcelIgnore
    @ApiModelProperty(value = "id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @ExcelProperty("租户名称")
    @ApiModelProperty(value = "租户名称")
    private String name;

    @TranslateName("dataSourceName")
    @TranslateByEntity(DataSource.class)
    @ExcelProperty(value = "租户数据源")
    @ApiModelProperty(value = "租户数据源(空是默认数据源)")
    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
    private String dataSourceId;

    @ExcelProperty(value = "是否禁用", converter = BooleanConverter.class)
    private Boolean disabled;

    @Override
    public Serializable primaryKey() {
        return id;
    }
}
